package response

type PageResponse struct {
	ResponseObject
	Data      interface{} `json:"data"`
	Page      int         `json:"page"`
	Size      int         `json:"size"`
	Total     int64       `json:"total"`
	TotalPage int64       `json:"totalPage"`
}

func SuccessPage(data interface{}, page, size int, total int64) *PageResponse {
	return &PageResponse{
		ResponseObject: *Success(data),
		Data:           data,
		Page:           page,
		Size:           size,
		Total:          total,
		TotalPage:      total/int64(size) + 1,
	}
}

func ErrorPage(code int, msg string) *PageResponse {
	return &PageResponse{
		ResponseObject: *Error(code, msg),
	}
}
